NO_COLOR=\x1b[0m
OK_COLOR=\x1b[32;01m
ERROR_COLOR=\x1b[31;01m
WARN_COLOR=\x1b[33;01m
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)
WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)
all: bin

bin: 
	@echo -------------------------------------
	@echo "-> Compiling all file..."
	@$(MAKE) -C src/
	@echo -n "Building bin..."
	@mkdir bin/
	@cp src/client bin/
	@cp src/server2 bin/
	@cp src/server bin/
	@cp src/reg_server bin/
	@echo -e "$(OK_STRING)"
	@echo --------------------------------
	@echo -e All file compiled! Now run "$(OK_COLOR)" make test "$(NO_COLOR)" to build test file and directory
	@echo --------------------------------

test:
	@echo -n Building test file...
	@mkdir test 
	@mkdir test/client0 test/client1 test/client2 test/client3 test/client4
	@echo test/client0 test/client1 test/client2 test/client3 test/client4 | xargs -n 1 cp src/client 
	@cp src/client_test test/ 
	@cp image/* test/client0 
	@cp src/reg_server test/ 
	@cp src/server test/ 
	@cp src/server2 test/ 
	@echo -e "$(OK_STRING)"
	


clean:	clean_test
	$(MAKE) clean -C src/
	rm -f config.h  config.log  config.status  Makefile
	rm -fr bin/
	@echo -e "$(OK_COLOR)" Cleaning was completely successful. "$(NO_COLOR)"
clean_test:
	rm -fr test/
